/*
	Name: 	change_team_gui.lua
	Side:	CLIENT
	
	Role: 	A quick gui for testing team changing
*/

local frame = vgui.Create("DFrame")
frame:SetSize( 640, 480 )
frame:Center()
frame:SetVisible(false)
frame:SetDeleteOnClose(false)

local panelList = vgui.Create( "DPanelList", frame )
panelList:SetPos( 50, 50 )
panelList:SetSize( 200, 400 )
panelList:SetSpacing( 16 )
panelList:SetPadding( 8 )
panelList:EnableVerticalScrollbar(true)

for id, data in pairs(team.GetAllTeams()) do
	
	local button = vgui.Create("DButton")
	button:SetSize( 168, 40 )
	button:SetText( "("..id..") "..data.Name )
	button.teamid = id
	button.DoClick = function( self )
		
		RunConsoleCommand( "zs_join_team", self.teamid )
		
	end
	
	panelList:AddItem( button )
end
ZS.TeamChangeFrame = frame

concommand.Add( "zs_showteams", function() 
	ZS.TeamChangeFrame:SetVisible(true)
	ZS.TeamChangeFrame:MakePopup(true) 
end )
	